#include <cstring>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

struct Interval {
    int start;
    int end;
    Interval() : start(0), end(0) {}
    Interval(int s, int e) : start(s), end(e) {}
};

vector<Interval> merge(vector<Interval>& intervals) {

    sort(intervals.begin(), intervals.end(), [](Interval a, Interval b){
        return a.start < b.start;
    });

    vector<Interval> ans;

    int cur = 0;
    int next = cur + 1;
    while(cur < intervals.size()){
        if(next == intervals.size()){
            ans.push_back(intervals[cur]);
            break;
        }
        if(intervals[next].start > intervals[cur].end){
            ans.push_back(intervals[cur]);
            cur = next;
        }else{
            intervals[cur].end = max(intervals[cur].end, intervals[next].end);
            next++;
        }
    }
    return ans;
}

int main() {
    return 0;
}